package exception;

public class TestException {

    public static void main(String[] args) {
        try {
            test();
        } catch (MyException e) {
            System.out.println("Catch My Exception");
            e.printStackTrace();
        }
    }

    public static void test() throws MyException {
        try {
            int i = 10 / 0;
            System.out.println("i= " + i);
        } catch (ArithmeticException e) {
            throw new MyException("this is MyException");
        }
    }/* Output
    Catch My Exception
    exception.MyException: this is MyException
            at exception.TestException.test(TestException.java:19)
            at exception.TestException.main(TestException.java:7)
    */

}
